#include "inithelper.h"

InitHelper::InitHelper(QString fileName)
{
    if (fileName == nullptr)
        fileName = "config.init";
    settings->setIniCodec("UTF-8");
    settings = new QSettings(fileName, QSettings::IniFormat);
}

void InitHelper::setValue(QString key, QString val)
{
    if (key == nullptr)
        return;
    if (val == nullptr)
        return;
    settings->setValue(key, val);
}

QString InitHelper::getValue(QString key)
{
    if (key == nullptr)
        return nullptr;
    return settings->value(key).toString();
}

InitHelper::~InitHelper()
{
    delete settings;
}
